package edu.cmu.ece.ds.droidchat.model;

import java.io.Serializable;

import android.graphics.drawable.Drawable;
import edu.cmu.ece.ds.droidchat.Toolbox;

/**
 * This class contains the whole user info. More than those displayed in the
 * nearby user list.
 */
public class UserInfo implements Serializable {
    /**
     *
     */
    private static final long serialVersionUID = 4175397163410019552L;
    private String nickName;
    private String status;
    private String username;
    private Drawable profilePicture;

    private String userIP; 	// the ip of this user
    private int round;  // this user is in my neighbor list because
    					//  the server said he was my neighbor in response to my location 
    					//  in round 'round'

	public UserInfo(String id, String name) {
        this(id, name, null);
    }

    public UserInfo(String username, String nickName, Drawable profilePhoto) {
        this.username = username;
        this.nickName = Toolbox.convertUnicodeEscape(nickName);
        this.profilePicture = profilePhoto;
    }

    public String getNickName() {
        return nickName;
    }

    public void setNickName(String nickName) {
        this.nickName = nickName;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public int getRound() {
		return round;
	}

	public void setRound(int round) {
		this.round = round;
	}
	
    public String getUserIP() {
		return userIP;
	}

	public void setUserIP(String ip_address) {
		this.userIP = ip_address;
	}

	public String getProfilePictureURLString() {
        return StringConstants.URL_PREFIX_FACEBOOK_GRAPH + username
                + StringConstants.URL_POSTFIX_FACEBOOK_PICTURE;
    }

    public Drawable getProfilePicture() {
        return profilePicture;
    }

    public void setProfilePicture(Drawable profilePicture) {
        this.profilePicture = profilePicture;
    }

    @Override
    public String toString() {
        return "UserInfo[username=" + username + ",nickName=" + nickName + "]";
    }

}
